package com.zhaoc.dao;

import com.zhaoc.domain.system.Menu;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * <p>title:com.zhaoc.dao</p>
 * date:2018/8/22 0022
 * time:19:58
 * author:赵成
 * user:13566
 */
public interface MenuRepository extends JpaRepository<Menu,Integer> {

    @Query("from Menu m inner join fetch m.roles r inner join fetch r.users u where u.id= ?1 order by m.priority")
    List<Menu> findByUser(int id);
}
